package prj3.ui;

import java.awt.Color;
import java.awt.Graphics;

import javax.swing.JPanel;


public class ColorPalettePanel extends JPanel {
	ColorPicker cp;
	int maxValue = 0;
	public ColorPalettePanel(int maxValue){
		cp = new ColorPicker(maxValue);
		this.maxValue = maxValue;
	}
	
	protected void paintComponent(Graphics g)
    {
		double w = getWidth();
		double h = getHeight();
		int num = maxValue / 5;
		for(int i = 0; i <= maxValue; i+= 5){
			int y = (int)((num - (i/5)) * (h/num));
			int yEnd = (int)(y + (h/num));
			int xEnd = (int)w/3;
			int x = 0;
			g.setColor(cp.getRednessColor(i));
			g.fillRect(x, y, xEnd, yEnd);
            g.setColor(Color.BLACK);
			g.drawString(""+i, x+2, (int)(y)+10);
		}
		
    }
	
	
	
}
